package com.cleaningcloud.cld.controller;

import com.cleaningcloud.cld.domain.vo.CldProjectEstimateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.service.ICldProjectEstimateService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;

/**
 * 项目估算Controller
 * 
 * @author cleaningcloud
 * @date 2024-10-10
 */
@RestController
@RequestMapping("/estimate")
public class CldProjectEstimateController extends BaseController
{
    @Autowired
    private ICldProjectEstimateService cldProjectEstimateService;


    /**
     * 获取项目->项目估算详情数据
     */
    @GetMapping(value = "/{projectId}")
    public AjaxResult getInfo(@PathVariable("projectId") Long projectId)
    {
        return success(cldProjectEstimateService.selectCldProjectEstimateByProjectId(projectId));
    }

    /**
     * 新增项目估算
     */
    @Log(title = "项目估算", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldProjectEstimateVo cldProjectEstimateVo)
    {
        return toAjax(cldProjectEstimateService.insertCldProjectEstimate(cldProjectEstimateVo));
    }

}
